package com.example.project.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "user_info")
@ApiModel("用户信息实体类")
public class UserInfoBean implements Serializable {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy =GenerationType.IDENTITY)//注解自增
    private Integer id;

    /**用户名*/
    @Column(name = "user_name")
    private String userName;

    /**密码*/
    @Column(name = "password")
    private String password;

    /**盐*/
    @Column(name = "salt")
    private String salt;

    /**真实姓名*/
    @Column(name = "real_name")
    private String realName;

    /**用户角色*/
    @Column(name = "role")
    private String role;

    /** 权限实体*/
    private String permission;

    /**状态（0：禁用；1：锁定；2：启用）*/
    @Column(name = "state")
    private Integer state;

    @Transient
    private String token;

    /**登录时间，放入redis中 */
    @Transient //忽略与数据库字段映射
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date loginTime;

    /**
     * 页码
     */
    int pageNum;
     
    /**
     * 每页数量
     */
    int pageSize;
}
